<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    // 理解 new的过程
    function Person(name){
        this.name = name
    }
    Person.prototype.getName = function(){
        return this.name
    };
    var objectFactory = function(){
        var obj = new Object(), Constructor = [].shift.call(arguments);
        obj.__proto__ = Constructor.prototype;
        var ret = Constructor.apply(obj,arguments);
        return typeof ret === 'object' ? ret :obj
    }
    var a = objectFactory(Person ,'Jim')
    console.log(a.name)
    console.log(a.getName())
    console.log(Object.getPrototypeOf(a) === Person.prototype)
    // page 20
</script>
</body>
</html>